import { _decorator, Component, Label, Node, v3, Vec2, Vec3 } from 'cc';
const { ccclass, property, executeInEditMode } = _decorator;

@ccclass('DotTest')
@executeInEditMode(true)
export class DotTest extends Component {
    @property(Node)
    node1: Node = null!;

    @property(Node)
    node2: Node = null!;

    @property(Label)
    dot1: Label = null!;

    @property(Label)
    dot2: Label = null!;

    start() {}

    update(deltaTime: number) {
        const pos1 = this.node1.position;
        const pos2 = this.node2.position;
        const dot1 = pos1.dot(pos2);
        const dot2 = pos1.add(pos2).normalize();

        this.dot1.string = dot1.toString();
        this.dot2.string = dot2.toString();
    }
}
